package com.haoshuang.zhouzhoubang.ui.page.mine.invite.record

import com.haoshuang.zhouzhoubang.R
import com.haoshuang.zhouzhoubang.databinding.ItemInviteTeamMemberRecordBinding
import com.haoshuang.zhouzhoubang.model.bean.SpreadServiceRecordBean
import com.mufeng.libs.base.BaseBindingHolder
import com.mufeng.libs.base.BaseBindingQuickAdapter
import com.mufeng.libs.utils.view.load
import com.mufeng.libs.utils.view.visibleOrGone


/**
 * 
 */
class InviteTeamMemberRecordAdapter(data: MutableList<SpreadServiceRecordBean>) : BaseBindingQuickAdapter<SpreadServiceRecordBean, ItemInviteTeamMemberRecordBinding>(data) {

    override fun onBindViewHolder(holder: BaseBindingHolder, position: Int, item: SpreadServiceRecordBean?) {
        holder.getViewBinding<ItemInviteTeamMemberRecordBinding>().apply {
            rivHead.load(item?.avatar, placeholder = R.mipmap.logo, error = R.mipmap.logo)
            if (item?.nickname.isNullOrEmpty()){
                tvNamePhone.text = "${item?.phone}"
            }else {
                tvNamePhone.text = "${item?.nickname} ${item?.phone}"
            }
            tvTime.text = item?.create_time
            tvStatus.text = item?.is_master_status
            tvContent.text = item?.content
            viewLine.visibleOrGone(position != itemCount - 1)
        }
    }

}